<!--注册安全工程师考试通过情况统计-->
<template>
  <Layout>
    <Tabs value="name1" ref="tabs">
      <TabPane label="列表" name="name1">
        <div>
          <Form ref="queryForm" :model="dataToQuery" :label-width="120" :loading="pageStatus.baseLoading">
            <Row class="query-form">
              <Col span="8">
                <FormItem label="单位名称：" prop="companyId">
                  <cascader-dom class="query-form-el" ref='queryOrgCascader' @setOrgInfo='setQueryCompanyName'
                                :orgTree="true" disabled
                                :setCurrentName="{label:dataToQuery.companyName,value:dataToQuery.companyId}"></cascader-dom>
                </FormItem>
              </Col>
              <Col span="8">
                <FormItem label="姓名：">
                  <Input type="text" class='query-form-el' v-model="dataToQuery.userName"
                         placeholder="请输入姓名/工作部门/手机号"></Input>
                </FormItem>
              </Col>
              <Col span="8" v-if="!switchFlag">
                <Button @click="switchQuery(true,75)" class="ivu-btn-switch" type="text">展开∨</Button>
                <Button @click="reset" class="ivu-btn-reset">重置</Button>
                <Button type="primary" class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
              </Col>
              <Col span="8" v-if="switchFlag">
                <FormItem label="年份：" prop="year">
                  <DatePicker class="query-form-el" placeholder="请选择年份" v-model='dataToQuery.yearDate' type="year">
                  </DatePicker>
                </FormItem>
              </Col>
            </Row>
            <Row v-show="switchFlag" class="query-form">
              <Col span="8">
                <FormItem label="二级集团:">
                  <Select v-model="dataToQuery.belongOrgId" class="query-form-el">
                    <Option v-for="item in twoLevelOrgList" :value="item.orgId" :key="item.orgId">{{ item.orgName }}
                    </Option>
                  </Select>
                </FormItem>
              </Col>
              <Col span="8">
                <FormItem label='报考科目：'>
                  <Select multiple v-model='dataToQuery.subjectQuery' class='query-form-el'>
                    <Option value="1">法律法规</Option>
                    <Option value="2">管理知识</Option>
                    <Option value="3">安全技术</Option>
                    <Option value="4">案例分析</Option>
                  </Select>
                </FormItem>
              </Col>
              <Col span="8">
                <FormItem label='通过科目：'>
                  <Select multiple v-model='dataToQuery.statusQuery' class='query-form-el'>
                    <Option value="1">法律法规</Option>
                    <Option value="2">管理知识</Option>
                    <Option value="3">安全技术</Option>
                    <Option value="4">案例分析</Option>
                  </Select>
                </FormItem>
              </Col>
            </Row>
            <Row v-show="switchFlag" class="query-form">
              <Col span="8" offset="16">
                <Button @click="switchQuery(false,75)" class="ivu-btn-switch" type="text">收起∧</Button>
                <Button @click="reset" class="ivu-btn-reset">重置</Button>
                <Button class="ivu-btn-query" icon="md-search" @click="query">查询</Button>
              </Col>
            </Row>
            <Row class="query-form">
              <Col span="24">
                <Button size="large" class="ivu-btn-add" icon="md-add" @click="addInfo">新增</Button>
                <download-button :api="exportUrl" :queryForm="dataToQuery"/>
                <!-- <Button type="primary" class="ivu-btn-add" icon="md-cloud-download" @click="exportFormSubmit">导出</Button> -->
              </Col>
            </Row>
          </Form>
          <Table ref='table' :height="tableHeight" :row-class-name="rowClassName" no-data-text="没有查询到相关数据!"
                 @on-selection-change='getSelectRows' :loading='pageStatus.loading || pageStatus.baseLoading' border
                 :columns="columns1" :data="dataTable">
          </Table>
          <Row style="margin-right:10px;">
            <Col span="24">
              <Page style="float: right" :total="pagedata.total" :page-size="pagedata.pageSize" @on-change="pageChange"
                    @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeArray" show-total show-sizer
                    show-elevator/>
            </Col>
          </Row>
        </div>
      </TabPane>
      <TabPane label="统计图" name="name2">
        <div ref="container" :style="{height: divHeight + 'px'}">
        </div>
      </TabPane>
    </Tabs>
    <Modal :title="mode == 'view' ?'注册安全工程师考试通过基本信息详情':'注册安全工程师考试通过基本信息'"
           :transfer=false :mask-closable="false"
           v-model="dialogShow" v-if="dataToView && dialogShow" :width=800 :styles="{height:'582px'}"
           class-name='limit-height-dialog'>
      <Row>
        <Col span="24">
          <Form ref="dialogForm" :class="mode === 'view'?'modal-view-detail':''" :show-message="false"
                :model="dataToView" :rules="mode === 'view'?{}:ruleCustom" :label-width="mode === 'view'?160:null"
                :label-position="mode === 'view'?'right':'top'">
            <Row type="flex" justify="space-around" class="code-row-bg">
              <Col span="23">
                <FormItem label='单位名称：' prop='companyId'>
                  <div v-if="mode === 'view'">{{ dataToView.companyName }}</div>
                  <cascader-dom v-else ref='orgCascader' @setOrgInfo='setCompanyId'
                                @setOrgname="setCompanyName" :orgTree="true" :currentOrgId="dataToView.companyId"
                                :setCurrentName="{label:dataToView.companyName,value:dataToView.companyId}">
                  </cascader-dom>
                </FormItem>
              </Col>
            </Row>
            <Row type="flex" justify="space-around" class="code-row-bg">
              <Col span="11">
                <FormItem label='姓名：' prop='userName'>
                  <div v-if="mode === 'view'">{{ dataToView.userName }}</div>
                  <Input v-else class='' placeholder="请填写姓名" type='text'
                         v-model='dataToView.userName'></Input>
                </FormItem>
              </Col>
              <Col span="11">
                <FormItem label='性别：' prop='gender'>
                  <div v-if="mode === 'view'">{{ dataToView.gender == 'M' ? '男' : '女' }}</div>
                  <Select v-else v-model='dataToView.gender' label-in-value @on-change="genderIdAndGender">
                    <Option value="M" lable="男">男</Option>
                    <Option value="F" lable="女">女</Option>
                  </Select>
                </FormItem>
              </Col>
            </Row>
            <Row type="flex" justify="space-around" class="code-row-bg">
              <Col span="11">
                <FormItem label='民族：' prop='nation'>
                  <div v-if="mode === 'view'">{{ dataToView.nation }}</div>
                  <Select v-else v-model="dataToView.nation" placeholder="请选择" filterable>
                    <Option v-for="item in nations" :key="item" :label="item" :value="item"></Option>
                  </Select>
                </FormItem>
              </Col>
              <Col span="11">
                <FormItem label='手机号：' prop='phoneNumber'>
                  <div v-if="mode === 'view'">{{ dataToView.phoneNumber }}</div>
                  <Input v-else class='' placeholder="请填写手机号" type='text'
                         v-model='dataToView.phoneNumber'></Input>
                </FormItem>
              </Col>
            </Row>
            <Row type="flex" justify="space-around" class="code-row-bg">
              <Col span="11">
                <FormItem label='工作部门：' prop='department'>
                  <div v-if="mode === 'view'">{{ dataToView.department }}</div>
                  <Input v-else class='' placeholder="请填写工作部门" type='text'
                         v-model='dataToView.department'></Input>
                </FormItem>
              </Col>
              <Col span="11">
                <FormItem label='参加或通过考试年份：' prop='year'>
                  <div v-if="mode === 'view'">{{ dataToView.year }}</div>
                  <DatePicker v-else class='w' placeholder="请选择年份" v-model='dataToView.yearDate' type="year">
                  </DatePicker>
                </FormItem>
              </Col>
            </Row>
            <Row type="flex" justify="space-around" class="code-row-bg">
              <Col span="23">
                <FormItem label='报考科目：' class="ivu-tile" prop="subjects">
                  <CheckboxGroup v-model="dataToView.lawsPoliciesSubjectArray">
                    <Checkbox :label="1">法律法规</Checkbox>
                  </CheckboxGroup>
                  <CheckboxGroup v-model="dataToView.managementSubjectArray">
                    <Checkbox :label="1">管理知识</Checkbox>
                  </CheckboxGroup>
                  <CheckboxGroup v-model="dataToView.securityTechSubjectArray">
                    <Checkbox :label="1">安全技术</Checkbox>
                  </CheckboxGroup>
                  <CheckboxGroup v-model="dataToView.caseAnalysisSubjectArray">
                    <Checkbox :label="1">案例分析</Checkbox>
                  </CheckboxGroup>
                </FormItem>
              </Col>
            </Row>
            <Row type="flex" justify="space-around" class="code-row-bg">
              <Col span="23">
                <FormItem label='通过科目：' class="ivu-tile">
                  <CheckboxGroup v-model="dataToView.lawsPoliciesStatusArray">
                    <Checkbox :label="1">法律法规</Checkbox>
                  </CheckboxGroup>
                  <CheckboxGroup v-model="dataToView.managementStatusArray">
                    <Checkbox :label="1">管理知识</Checkbox>
                  </CheckboxGroup>
                  <CheckboxGroup v-model="dataToView.securityTechStatusArray">
                    <Checkbox :label="1">安全技术</Checkbox>
                  </CheckboxGroup>
                  <CheckboxGroup v-model="dataToView.caseAnalysisStatusArray">
                    <Checkbox :label="1">案例分析</Checkbox>
                  </CheckboxGroup>
                </FormItem>
              </Col>
            </Row>
            <Row type="flex" justify="space-around" class="code-row-bg">
              <Col span="11">
                <FormItem label='有效期内通过科数：' prop='countAsValid'>
                  <div v-if="mode === 'view'">{{ dataToView.countAsValid }}</div>
                  <InputNumber v-else class='w' :min="0" :max="4" placeholder="请填写有效期内通过科数" type='text'
                               v-model='countAsValid'></InputNumber>
                </FormItem>
              </Col>
              <Col span="11">
                <FormItem label='是否注册：' class="ivu-tile">
                  <RadioGroup v-model="dataToView.register">
                    <Radio label="1">是</Radio>
                    <Radio label="0">否</Radio>
                  </RadioGroup>
                </FormItem>
              </Col>
            </Row>
            <!-- <Row type="flex" justify="space-around" class="code-row-bg">
          <Col span="11">
            <FormItem label='是否注册：' class="ivu-tile" >
              <RadioGroup v-model="dataToView.register">
                <Radio label="1">是</Radio>
                <Radio label="0">否</Radio>
              </RadioGroup>
            </FormItem>
          </Col>
          <Col span="11"></Col>
        </Row> -->
          </Form>
        </Col>
      </Row>
      <div slot="footer">
        <Button v-if="mode != 'view'" type="primary" class='ivu-btn-save'
                @click="submit('dialogForm')">确定
        </Button>
        <Button v-if="mode != 'view'" type="primary" class='ivu-btn-cancel' @click="handleCancel">取消</Button>
        <Button v-if="mode === 'view'" class='ivu-btn-save' @click="dialogShow=false">关闭</Button>
      </div>
    </Modal>
    <Modal :title="statisticsTitle" :transfer=false v-model="passRateRecordVisible" :width=1200 footer-hide>
      <Table ref='table' :loading="loading" size="small" class="table" :height=500 no-data-text="没有查询到相关数据!"
             highlight-row stripe border :columns="staticticsColumns" width="100%" :data="statisticsInfo">
      </Table>
      <Page :total="statisticsPagedata.total" :page-size="statisticsPagedata.pageSize"
            @on-change="staticticsPageChange" @on-page-size-change='staticticsSizeChange' show-total show-sizer
            show-elevator/>
    </Modal>
  </Layout>
</template>

<script>
import {
  Api
} from '@/api/index.js'
import {
  sessionStorage
} from '@/common/cacheUtils.js';
import {
  formatDate,
  createFormAndSubmit
} from '@/tools/index'
import _deepclone from 'lodash/cloneDeep'
import {
  mapState,
  mapGetters,
  mapActions
} from 'vuex'

var cascaderDom = () => import('@/components/cascader-dom.vue');
import pageCommonFunction from '@/components/pageCommonFunction.js'
import echarts from "echarts";

export default {
  components: {
    cascaderDom
  },
  data() {
    return {
      ...this.createCommonDataField(),
      divHeight: 0,
      loading: false,
      statisticsTitle: "",
      statisticsPagedata: {
        total: 0, //总条数
        fromPage: 1,//从n条开始
        pageSize: 10//每页多少条
      },
      staticticsColumns: [
        {
          title: '序号', width: 80, fixed: 'left', align: 'center', render: (h, params) => {
            return h('span', params.index + (this.statisticsPagedata.fromPage - 1) * this.statisticsPagedata.pageSize + 1);
          }
        },
        {key: 'orgName', title: '单位名称', fixed: 'left', align: 'center', width: 200},
        {
          key: 'size1',
          title: new Date().getFullYear() - 2 + '年报考人数',
          fixed: 'left',
          align: 'center',
          minWidth: 120
        },
        {
          key: 'validSum1',
          title: new Date().getFullYear() - 2 + '年通过人数',
          fixed: 'left',
          align: 'center',
          minWidth: 120
        },
        {
          key: 'size2',
          title: new Date().getFullYear() - 1 + '年报考人数',
          fixed: 'left',
          align: 'center',
          minWidth: 120
        },
        {
          key: 'validSum2',
          title: new Date().getFullYear() - 1 + '年通过人数',
          fixed: 'left',
          align: 'center',
          minWidth: 120
        },
        {key: 'size3', title: new Date().getFullYear() + '年报考人数', fixed: 'left', align: 'center', minWidth: 120},
        {
          key: 'validSum3',
          title: new Date().getFullYear() + '年通过人数',
          fixed: 'left',
          align: 'center',
          minWidth: 120
        },
      ],
      statisticsInfo: [],
      modaleshow: 1,
      nations: ['汉族', '壮族', '满族', '回族', '苗族', '维吾尔族', '土家族', '彝族', '蒙古族', '藏族', '布依族', '侗族', '瑶族', '朝鲜族', '白族',
        '哈尼族',
        '哈萨克族', '黎族', '傣族', '畲族', '傈僳族', '仡佬族', '东乡族', '高山族', '拉祜族', '水族', '佤族', '纳西族', '羌族', '土族', '仫佬族',
        '锡伯族',
        '柯尔克孜族', '达斡尔族', '景颇族', '毛南族', '撒拉族', '布朗族', '塔吉克族', '阿昌族', '普米族', '鄂温克族', '怒族', '京族', '基诺族',
        '德昂族', '保安族',
        '俄罗斯族', '裕固族', '乌孜别克族', '门巴族', '鄂伦春族', '独龙族', '塔塔尔族', '赫哲族', '珞巴族'
      ],
      columns1: [{
        title: '序号',
        width: 80,
        fixed: 'left',
        align: 'center',
        render: this.indexColumnsRenderSum
      },
        {
          key: 'companyName',
          title: '单位名称',
          align: 'center',
          width: 260
        },
        {
          key: 'userName',
          title: '姓名',
          align: 'center',
          width: 100
        },
        {
          key: 'gender',
          title: '性别',
          align: 'center',
          width: 70,
          render: (h, params) => {
            return h('span', params.row.gender == 'M' ? '男' : params.row.gender == 'F' ? '女' : '')
          }
        },
        {
          key: 'nation',
          title: '民族',
          align: 'center',
          width: 70
        },
        {
          key: 'department',
          title: '工作部门',
          align: 'center',
          width: 120
        },
        {
          key: 'phoneNumber',
          title: '手机号',
          align: 'center',
          width: 120
        },
        {
          key: 'year',
          title: '参加或通过考试年份年份',
          align: 'center',
          width: 110
        },
        // { key:'register',title: '是否注册',  align: 'center', width: 90, render: (h, params) => {
        // 	return h('span', params.row.register == '1' ? '是' : '否')}},
        {
          key: 'countAsValid',
          title: '有效期内通过科数',
          align: 'center',
          width: 100
        },
        {
          minWidth: 150,
          title: '报考科目',
          align: 'center',
          children: [{
            key: 'lawsPoliciesSubject',
            title: '法律法规',
            align: 'center',
            width: 100,
            // render: (h, params) => {return h('span', params.row.lawsPoliciesSubject == '1' ? '1' : '0')}
          },
            {
              key: 'managementSubject',
              title: '管理知识',
              align: 'center',
              width: 100,
              // render: (h, params) => {return h('span', params.row.managementSubject == '1' ? '1' : '0')}
            },
            {
              key: 'securityTechSubject',
              title: '安全技术',
              align: 'center',
              width: 100,
              // render: (h, params) => {return h('span', params.row.securityTechSubject == '1' ? '1' : '0')}
            },
            {
              key: 'caseAnalysisSubject',
              title: '案例分析',
              align: 'center',
              width: 100,
              // render: (h, params) => {return h('span', params.row.caseAnalysisSubject == '1' ? '1' : '0')}
            },
          ]
        },
        {
          minWidth: 150,
          title: '通过科目',
          align: 'center',
          children: [{
            key: 'lawsPoliciesStatus',
            title: '法律法规',
            align: 'center',
            width: 100,
            // render: (h, params) => {return h('span', params.row.lawsPoliciesStatus == '1' ? '1' : '0')}
          },
            {
              key: 'managementStatus',
              title: '管理知识',
              align: 'center',
              width: 100,
              // render: (h, params) => {return h('span', params.row.managementStatus == '1' ? '1' : '0')}
            },
            {
              key: 'securityTechStatus',
              title: '安全技术',
              align: 'center',
              width: 100,
              // render: (h, params) => {return h('span', params.row.securityTechStatus == '1' ? '1' : '0')}
            },
            {
              key: 'caseAnalysisStatus',
              title: '案例分析',
              align: 'center',
              width: 100,
              // render: (h, params) => {return h('span', params.row.caseAnalysisStatus == '1' ? '1' : '0')}
            },
          ]
        },
        this.getActionColumns((params) => {
          return params.row.id === '-1';
        }),
      ],
      ruleCustom: {
        orgId: [{
          required: true,
          message: '请填写单位名称',
          trigger: 'change'
        }],
        userName: [{
          required: true,
          message: '请填写姓名',
          trigger: 'change'
        }],
        department: [{
          required: true,
          message: '请填写工作部门',
          trigger: 'change'
        }],
        register: [{
          required: true,
          message: '请选择是否注册',
          trigger: 'change'
        }],
        countAsValid: [{
          pattern: /^([0-9][0-9]*)?$/,
          required: true,
          message: '请填写有效期内通过科数,必须为数字',
          trigger: 'change, blur',
          type: 'number'
        }],
        phoneNumber: [{
          pattern: /^1[0-9]{10}$/,
          required: true,
          message: '请填写手机号',
          trigger: 'change'
        }],
        year: [{
          validator: (rule, value, callback) => {
            if (this.dataToView.yearDate == null || this.dataToView.yearDate == '' || this
                .dataToView.yearDate == undefined) {
              callback(' ')
            } else {
              callback()
            }
          },
          required: true,
          trigger: 'change'
        }],
      },
      tableHeight: 10,
      // api
      queryUrl: Api.queryPassRateRecords,
      exportUrl: Api.exportPassRateRecords,
      deleteUrl: Api.deletePassRateRecords,
      updateUrl: Api.updatePassRateRecords,
      saveUrl: Api.savePassRateRecords,
      twoLevelOrgList: [],
      passRateRecordVisible: false,
      clickParam: {}
    }
  },
  computed: {
    countAsValid: function () {
      let sum = 0
      let aa = this.blackMethod(this.dataToView.lawsPoliciesStatusArray)
      let aa1 = this.blackMethod(this.dataToView.managementStatusArray)
      let aa2 = this.blackMethod(this.dataToView.securityTechStatusArray)
      let aa3 = this.blackMethod(this.dataToView.caseAnalysisStatusArray)
      sum = aa + aa1 + aa2 + aa3
      this.dataToView.countAsValid = sum
      return this.dataToView.countAsValid

    },
  },
  async mounted() {
    this.divHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 190;
    this.setTableHeight(305);
    this.query();
    this.$http.get(Api.twoPlusFourReceipt + '/twoLevelOrg').then((res) => {
      if (res.data.status == 200) {
        this.twoLevelOrgList = res.data.data;
      }
    });
    this.$nextTick(() => {
      this.loadPassRateRecordsStatistics();
    });
  },
  methods: {
    ...pageCommonFunction,
    lowerStep(name) {
      this.modaleshow = name
      // this.query()
    },
    loadPassRateRecordsStatistics() {
      let passRateRecordContainer = echarts.init(this.$refs.container);
      this.$http.get(Api.queryPassRateRecordsToTwoLevelStatistics).then(res => {
        if (res.data.status == 200) {
          let map = res.data.data
          let barOption = this.getOption(map.tooltipTitle)
          barOption.series = map.monthList
          barOption.xAxis[0].data = map.xAxisData
          passRateRecordContainer.setOption(barOption);
          passRateRecordContainer.on('click', (param) => {
            if (param.name !== '北京金隅集团股份有限公司') {
              event.stopPropagation()// 阻止冒泡
              this.clickParam = param;
              this.passRateRecordVisible = true;
              this.statisticsPagedata.fromPage = 1
              this.statisticsPagedata.pageSize = 10
              this.statisticsPagedata.total = 0;
              this.statisticsTitle = param.name + '详情';
              this.queryPassRateRecordsByTwoLevel();
            }
          });
        }
      });
    },
    queryPassRateRecordsByTwoLevel() {
      let orgName = this.clickParam.name;
      this.loading = true;
      let data = {
        conditions: {orgName: orgName},
        startPage: this.statisticsPagedata.fromPage,
        size: this.statisticsPagedata.pageSize,
      }
      this.$http.get(Api.queryPassRateRecordsByTwoLevelIdStatistics, {params: data}).then(r => {
        this.statisticsInfo = r.data.data.data;
        this.statisticsPagedata.total = r.data.data.totalSize;
        this.loading = false;
      });
    },
    getOption(tooltipTitle) {
      let option = {
        title: {
          // text: '集团历年事故伤害程度人数统计',
          textStyle: {
            fontSize: 14
          }
        },
        tooltip: { //提示框组件
          trigger: 'axis',
          formatter(params) {
            return tooltipTitle[params[0].name]
          },
          axisPointer: { // 坐标轴指示器，坐标轴触发有效
            type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
          }
        },
        legend: { //图例组件
          // right: 10,
          // data: ['轻伤人数', '重伤人数', '死亡人数']
        },
        color: ['#40C4FF', '#FDD835'],
        grid: {
          left: '3%',
          right: '3%',
          bottom: '3%',
          containLabel: true,
        },
        xAxis: [{
          type: 'category',
          data: [], //动态
          axisLabel: {
            interval: 0,
            formatter: function (value) {
              var str = "";
              var num = 6; //每行显示字数
              var valLength = value.length; //该项x轴字数
              var rowNum = Math.ceil(valLength / num); // 行数
              if (rowNum > 1) {
                for (var i = 0; i < rowNum; i++) {
                  var temp = "";
                  var start = i * num;
                  var end = start + num;
                  temp = value.substring(start, end) + "\n";
                  str += temp;
                }
                return str;
              } else {
                return value;
              }
            }
          }
        }],
        yAxis: [{
          type: 'value'
        }],
        series: [
          {
            name: '2021年轻伤人数',
            type: 'bar',
            stack: '轻伤人数',
            emphasis: {
              focus: 'series'
            },
            data: []
          },
        ]
      };
      return option;
    },
    blackMethod(val) {
      if (val && val.length > 0) {
        return val[0]
      }
      return 0
    },
    beforeViewDialogOpen(data) {
      this.editDataBack(data);
    },
    beforeEditDialogOpen(data) {
      this.editDataBack(data);
    },
    editDataBack(data) {
      data.row.lawsPoliciesSubjectArray = data.row.lawsPoliciesSubject == 1 ? [1] : [];
      data.row.managementSubjectArray = data.row.managementSubject == 1 ? [1] : [];
      data.row.securityTechSubjectArray = data.row.securityTechSubject == 1 ? [1] : [];
      data.row.caseAnalysisSubjectArray = data.row.caseAnalysisSubject == 1 ? [1] : [];
      data.row.lawsPoliciesStatusArray = data.row.lawsPoliciesStatus == 1 ? [1] : [];
      data.row.managementStatusArray = data.row.managementStatus == 1 ? [1] : [];
      data.row.securityTechStatusArray = data.row.securityTechStatus == 1 ? [1] : [];
      data.row.caseAnalysisStatusArray = data.row.caseAnalysisStatus == 1 ? [1] : [];
      let year = data.row.year + '-01-01';
      data.row.yearDate = new Date(Date.parse(year.replace(/-/g, "/")));
      data.row = data.row
    },
    deleteData(params) {
      this.deleteDateAjax(params);
    },
    query() {
      if (this.dataToQuery.subjectQuery != null && this.dataToQuery.subjectQuery != undefined && this.dataToQuery
          .subjectQuery.length < 1) {
        this.dataToQuery.subjectQuery = null
      }
      if (this.dataToQuery.statusQuery != null && this.dataToQuery.statusQuery != undefined && this.dataToQuery
          .statusQuery.length < 1) {
        this.dataToQuery.statusQuery = null
      }
      if (this.dataToQuery.yearDate) {
        this.dataToQuery.year = this.dataToQuery.yearDate.getFullYear();
      }
      this.dataToQuery.orgId = sessionStorage('userId').getObject('userId').companyId
      this.queryAjax();
    },
    submit(name) {
      //二级集团
      this.dataToView.twoLevelOrgId = sessionStorage('userId').getObject('userId').twoLevelOrgId;

      if (this.dataToView.yearDate) {
        this.dataToView.year = this.dataToView.yearDate.getFullYear();
      }
      this.dataToView.lawsPoliciesSubject = this.blackMethod(this.dataToView.lawsPoliciesSubjectArray);
      this.dataToView.managementSubject = this.blackMethod(this.dataToView.managementSubjectArray)
      this.dataToView.securityTechSubject = this.blackMethod(this.dataToView.securityTechSubjectArray)
      this.dataToView.caseAnalysisSubject = this.blackMethod(this.dataToView.caseAnalysisSubjectArray)
      this.dataToView.lawsPoliciesStatus = this.blackMethod(this.dataToView.lawsPoliciesStatusArray)
      this.dataToView.managementStatus = this.blackMethod(this.dataToView.managementStatusArray)
      this.dataToView.securityTechStatus = this.blackMethod(this.dataToView.securityTechStatusArray)
      this.dataToView.caseAnalysisStatus = this.blackMethod(this.dataToView.caseAnalysisStatusArray)

      this.submitAjax(name);
    },
    genderIdAndGender(value) {
      this.dataToView.gender = value.label
      this.dataToView.gender = value.value
    },
    createEmptyDataToAdd() {
      return {
        userName: sessionStorage('userId').getObject('userId').userName,
        countAsValid: 0,
        register: "1",
      }
    },
    staticticsSizeChange(pageSize) {
      this.statisticsPagedata.pageSize = pageSize;
      this.queryPassRateRecordsByTwoLevel();
    },
    staticticsPageChange(pageNum) {
      this.statisticsPagedata.fromPage = pageNum;
      this.queryPassRateRecordsByTwoLevel();
    }
  },
  watch: {},
}
</script>
<style>
.ivu-tile div {
  display: flex;
}
</style>
<style lang='css' scoped>
@import '../../../index.css';
</style>
